<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 写一个函数，用户输入任意两个数字的任意算术运算（简单的计算器小功能），并能弹出运算后的结果。 -->
    <script>
      function getSums(num1, num2, num3) {
        num1 = +prompt('请输入第一个数:')
        num2 = +prompt('请输入第二个数:')
        num3 = prompt('请输入运算符号:')
        var sum = [num1 + num2, num1 - num2, num1 * num2, num1 / num2]
        if (num3 === '+' ) {
            sum = sum[0]
        } else if (num3 == '-') {
            sum = sum[1]
        }else if (num3 == '*') {
            sum = sum[2]
        } else {
            sum = sum[3]
        }
        return sum
      }

      alert(getSums())
    </script>
  </body>
</html>
